#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author Jmz

##   原理
#
# class Mymeta(type):
#     def __call__(self, *args, **kwargs):
#         print('====>run')
#         return 1212
#
#
# class People(object,metaclass=Mymeta):  # class 定义时其实就是调用了 People = Mymeta("People",(object,),{...函数体...# })
#     '''
#     类注释
#     '''
#     def __init__(self,name,age):
#         self.name = name
#         self.age = age
#
#     def eat(self):
#         print('%s is eating'%self.name)
#
#
# p1 = People('jmz',12)       # 这个类的实际就是调用了 元类的 __call__  方法
#
# print(p1)










class Mymeta(type):
    def __call__(self, *args, **kwargs):
        # self.__new__()
        pass

    def __new__(cls, *args, **kwargs):
        print('mymeta')

    def eat(self):
        print('mymeta eat')

class People(object,metaclass=Mymeta):  # class 定义时其实就是调用了 People = Mymeta("People",(object,),{...函数体...# })
    '''
    类注释
    '''
    def __init__(self,name,age):
        self.name = name
        self.age = age

    def eat(self):
        print('people eat')

    def __new__(cls, *args, **kwargs):
        print('prople')


# p1 = People('jmz',12)       # 这个类的实际就是调用了 元类的 __call__  方法

# print(p1)